//
// Created by isabella on 25-6-1.
//
#include <common.h>

#include <utility>

#include "Sort.h"

#include "json.hpp"


class Solution {
public:
    unique_ptr<Sort> bubble_sort = make_unique<BubbleSort>();
    unique_ptr<Sort> selection_sort = make_unique<SelectionSort>();
    unique_ptr<Sort> quick_sort = make_unique<QuickSort>();
    unique_ptr<Sort> merge_sort = make_unique<MergeSort>();
    unique_ptr<Sort> shell_sort = make_unique<ShellSort>();
    unique_ptr<Sort> heap_sort = make_unique<HeapSort>();
    unique_ptr<Sort> counting_sort = make_unique<CountingSort>();
    vector<int> nums;

    Solution() = default;

    explicit Solution(vector<int> v) {
        this->nums = std::move(v);
    }

    auto sort(Sort *s) {
        return s->sort(nums);
    }
};


int main() {
    nlohmann::json j;
    vector<int> data1 = {21, 1, 4, 6, 2, 474, 3, 15, 14, 46, 32, 2, 1};
    vector<int> data2 = {1, 4, 2, 7, 5, 7, 3, 1, 4, 1, 5, 9, 2, 6};
    auto sp = new Solution(data2);
    j["unsorted"] = data2;
    auto res = sp->sort(sp->counting_sort.get());
    j["sorted"] = res;
    cout << j.dump() << endl;
    delete sp;
    return 0;
}
